/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.oa.action.humanresources;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.oa.mapper.humanresources.TimeManageMapper;
public class TimeManage extends BaseAction
{
    @Autowired(required=false)
	private TimeManageMapper mapper;
    /**
    每天时间设置
    */
    
    public Map dayTimeSet() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_hour=mapper.s_hour(params);
        result.put("s_hour", s_hour);
        
        
        SQLList<SQLMap> s_minute=mapper.s_minute(params);
        result.put("s_minute", s_minute);
        
        
        SQLList<SQLMap> l_worktime=mapper.l_worktime(params);
        result.put("l_worktime", l_worktime);
        
        return result;
    }
    /**
    增加新的时间段
    */
    
    public Map dayTimeAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_hour=mapper.s_hour(params);
        result.put("s_hour", s_hour);
        
        
        SQLList<SQLMap> s_minute=mapper.s_minute(params);
        result.put("s_minute", s_minute);
        
        return result;
    }
    /**
    加班时间设置
    */
    
    public Map overtimeSet() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> p_worktime=mapper.p_worktime(params,pagination);
        p_worktime.setPagedListInfo(pagination);
        result.put("p_worktime", p_worktime);
        
        return result;
    }
    /**
    增加时间
    */
    
    public Map overtimeAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_hour=mapper.s_hour(params);
        result.put("s_hour", s_hour);
        
        
        SQLList<SQLMap> s_minute=mapper.s_minute(params);
        result.put("s_minute", s_minute);
        
        return result;
    }
    /**
    增加日期时间
    */
    
    public Map overtimeDateAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> l_worktime_day=mapper.l_worktime_day(params);
        result.put("l_worktime_day", l_worktime_day);
        
        
        SQLList<SQLMap> s_hour=mapper.s_hour(params);
        result.put("s_hour", s_hour);
        
        
        SQLList<SQLMap> s_minute=mapper.s_minute(params);
        result.put("s_minute", s_minute);
        
        return result;
    }
    /**
    节假日设置
    */
    
    public Map holidaySet() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        params.def("day_type",1);
        SQLList<SQLMap> l_worktime_holiday=mapper.l_worktime_holiday(params);
        result.put("l_worktime_holiday", l_worktime_holiday);
        
        return result;
    }
    /**
    工作时间管理
    */
    
    public Map workingTimeAdmin() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> l_worktime_week=mapper.l_worktime_week(params);
        result.put("l_worktime_week", l_worktime_week);
        
        
        SQLList<SQLMap> s_worktime_week=mapper.s_worktime_week(params);
        result.put("s_worktime_week", s_worktime_week);
        
        return result;
    }
    /**
    每天时间设置修改
    */
    
    public Map dayTimeSetSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("v_start_hour", SQL.setTime(null,getParameter("startHour"),getParameter("startMinute"),null));
        
        
        result.put("v_end_hour", SQL.setTime(null,getParameter("endHour"),getParameter("endMinute"),null));
        
        
        params.def("startHour",-1);
        params.def("endHour",-1);
        int id = mapper.id(params);
        result.put("id", id);
        
        return result;
    }
    /**
    */
    
    public Map d_worktime() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_worktime(params);
        
        return result;
    }
    /**
    增加新的时间段修改
    */
    
    public Map dayTimeAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("v_start_hour", SQL.setTime(null,getParameter("startHour"),getParameter("startMinute"),null));
        
        
        result.put("v_end_hour", SQL.setTime(null,getParameter("endHour"),getParameter("endMinute"),null));
        
        
        params.def("startHour",-1);
        params.def("endHour",-1);
        int id = mapper.id(params);
        result.put("id", id);
        
        return result;
    }
    /**
    增加时间修改
    */
    
    public Map overtimeAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("v_start_hour", SQL.setTime(null,getParameter("startHour"),getParameter("startMinute"),null));
        
        
        result.put("v_end_hour", SQL.setTime(null,getParameter("endHour"),getParameter("endMinute"),null));
        
        
        params.def("startHour",-1);
        params.def("endHour",-1);
        params.def("work_day","''");
        params.def("work_day",null);
        int id = mapper.id(params);
        result.put("id", id);
        
        return result;
    }
    /**
    增加日期时间修改
    */
    
    public Map overtimeDateAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("v_start_hour", SQL.setTime(null,getParameter("startHour"),getParameter("startMinute"),null));
        
        
        result.put("v_end_hour", SQL.setTime(null,getParameter("endHour"),getParameter("endMinute"),null));
        
        
        params.def("startHour",-1);
        params.def("endHour",-1);
        params.def("work_day","''");
        params.def("work_day",null);
        int id = mapper.id(params);
        result.put("id", id);
        
        return result;
    }
    /**
    增加节假日修改
    */
    
    public Map holiday_AddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        params.def("work_day","''");
        params.def("day_type",-1);
        int id = mapper.id(params);
        result.put("id", id);
        
        return result;
    }
    /**
    工作时间管理修改
    */
    
    public Map workingTimeAdminSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("worktime_week")){
            params=new SQLParam(request,emt.getMap());
            mapper.workingTimeAdminSubmit(params);
        }
        
        return result;
    }
}